﻿using DevExpress.XtraTab;
using DXApplicationTangche.UC.成品出库单.service;
using DXApplicationTangche.UC.盘点.Service;
using DXApplicationTangche.UC.盘点.盘点UC;
using DXApplicationTangche.UC.项目流程.流程UC;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.盘点
{
    public partial class Form盘点完成 : DevExpress.XtraEditors.XtraForm
    {
        //private XtraUserControl在库一览 uc在库一览;
        private List<StockInOutDetailDTO> stockInOutDetailDTOs盘盈=new List<StockInOutDetailDTO>();//盘盈一览
        private String stockStoreInventoryPlanCode;//门店盘点计划号
        private StockStoreInventoryPlanDTO stockStoreInventoryPlanDTO;//门店盘点计划
        private String stockInventoryPlanCode;//盘点大计划号
        private StockInventoryPlanDTO stockInventoryPlanDTO;//盘点大计划

        public Form盘点完成(StockStoreInventoryPlanDTO stockStoreInventoryPlanDTO)
        {
            InitializeComponent();
            this.stockStoreInventoryPlanDTO = stockStoreInventoryPlanDTO;
            this.refreshDataSurplus();
            this.refreshDataLose();
        }
        public Form盘点完成(StockInventoryPlanDTO stockInventoryPlanDTO)
        {
            InitializeComponent();
            this.stockInventoryPlanDTO = stockInventoryPlanDTO;
            this.loadTab();
        }
        private void loadTab()
        {
            foreach(StockStoreInventoryPlanShowDTO showDTO in this.stockInventoryPlanDTO.stockStoreInventoryPlanShowDTOS)
            {
                this.addTab(showDTO);
            }
        }
        private void addTab(StockStoreInventoryPlanShowDTO stockStoreInventoryPlanShowDTO)
        {
            XtraTabPage newTabPage = new XtraTabPage();
            newTabPage.Name = stockStoreInventoryPlanShowDTO.storeName + "盘点计划";//设置新TabPage的Name
            newTabPage.Text = stockStoreInventoryPlanShowDTO.storeName + "盘点计划";//设置新TabPage的标题文本
            //form.TopLevel = false;
            XtraUserControl盘点完成 xtraUserControl = new XtraUserControl盘点完成(stockStoreInventoryPlanShowDTO.stockStoreInventoryPlanCode);
            this.xtraTabControl盘点完成情况.TabPages.Add(newTabPage);//添加
            //this.xtraTabControl盘点完成情况.SelectedTabPage = newTabPage;//设置为选中
            newTabPage.Controls.Add(xtraUserControl);
            xtraUserControl.Dock = System.Windows.Forms.DockStyle.Fill;
            xtraUserControl.Show();
        }

        private void refreshDataSurplus()
        {
            XtraTabPage newTabPage = new XtraTabPage();
            newTabPage.Name = stockStoreInventoryPlanDTO.storeName + "盘盈情况";//设置新TabPage的Name
            newTabPage.Text = stockStoreInventoryPlanDTO.storeName + "盘盈情况";//设置新TabPage的标题文本
            //form.TopLevel = false;
            XtraUserControl盘盈处理 xtraUserControl = new XtraUserControl盘盈处理(stockStoreInventoryPlanDTO);
            //XtraUserControl盘点完成 xtraUserControl = new XtraUserControl盘点完成(stockStoreInventoryPlanDTO.stockStoreInventoryPlanCode);
            this.xtraTabControl盘点完成情况.TabPages.Add(newTabPage);//添加
            //this.xtraTabControl盘点完成情况.SelectedTabPage = newTabPage;//设置为选中
            newTabPage.Controls.Add(xtraUserControl);
            xtraUserControl.Dock = System.Windows.Forms.DockStyle.Fill;
            xtraUserControl.Show();
        }
        private void refreshDataLose()
        {
            XtraTabPage newTabPage = new XtraTabPage();
            newTabPage.Name = stockStoreInventoryPlanDTO.storeName + "盘亏情况";//设置新TabPage的Name
            newTabPage.Text = stockStoreInventoryPlanDTO.storeName + "盘亏情况";//设置新TabPage的标题文本
            //form.TopLevel = false;
            XtraUserControl盘亏处理 xtraUserControl = new XtraUserControl盘亏处理(stockStoreInventoryPlanDTO);
            //XtraUserControl盘点完成 xtraUserControl = new XtraUserControl盘点完成(stockStoreInventoryPlanDTO.stockStoreInventoryPlanCode);
            this.xtraTabControl盘点完成情况.TabPages.Add(newTabPage);//添加
            //this.xtraTabControl盘点完成情况.SelectedTabPage = newTabPage;//设置为选中
            newTabPage.Controls.Add(xtraUserControl);
            xtraUserControl.Dock = System.Windows.Forms.DockStyle.Fill;
            xtraUserControl.Show();
        }
    }
}
